<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Calendar</title>
    <style type="text/css">
        body {
            background: #f7f7f7;
        }
        .calendar-container {
            margin: 2px;
            background: #fff;
        }
        #content {
            height: 330px;
        }
        /* 默认样式 */
        .calendar-header {
            display: flex;
            padding-top: 10px;
        }
        .calendar-header-left, .calendar-header-right {
            width: 72px;
            color: #8D91A2;
            font-size: 14px;
        }
        .calendar-header-left {
            text-align: left;
        }
        .calendar-header-right {
            text-align: right;
        }
        .calendar-header-center {
            flex: 1;
            text-align: center;
            color: #42436A;
            font-size: 16px;
        }
        .calendar-header-center span {
            vertical-align: middle;
        }
        .calendar-header-center .angle-down {
            width: 32px;
            height: 32px;
            display: inline-block;
            background: url(angle-down.png) no-repeat;
            background-position: center;
            background-size: cover;
            vertical-align: middle;
        }
        .g-content-box ul, .g-dete-header-ul {
            padding: 0;
            overflow: hidden;
            margin: 12px 0;
        }
        .g-dete-header-ul li {
            height: 40px;
            line-height: 40px;
            color: #42436a;
        }
        .g-content-box ul li {
            color: #c6c8d0;;
        }
        .g-content-box ul li,.g-dete-header-ul li{
            float: left;
            height: 40px;
            list-style: none;
            text-align: center;
            width: 14%;
            -webkit-tap-highlight-color: rgba(0,0,0,0);
        }
        .g-content-box ul li span{
            width: 34px;
            height: 34px;
            display: inline-block;
            border-radius: 100%;
            line-height: 34px;
            cursor: pointer;
            box-sizing: border-box;
        }
        /*可操作区域样式 */
    
        /* 灰色区域样式 */
        .g-date-body-ul .g-calendar-grey {
            color: #C9C9C9;
        }
    
    
        /* 可自定义样式 */
        .cus-style li {
            /* border:1px solid #000; */
        }
        /* 默认激活样式 */
        .g-date-body-ul .defalutActive{
            color:#fff;
            background: #6ed362;
        }
        /* 激活样式 */
        .g-date-body-ul .active{
            background: #F2F2F2 !important;
            border: 0;
            border-radius: 100%;
            /* box-shadow: 1px 2px 4px #d6d6d6; */
        }
        /* 标记样式 */
        .g-date-body-ul .g-mark-time-conflict {
            color: #ffa63b;
        }
        .g-date-body-ul .g-mark-sending {
            color: #8833f3;
        }
        .g-date-body-ul .g-mark-notsend {
            color: #ff0014;
        }
        .g-date-body-ul .g-mark-completed {
            color: #46be0a;
        }
        .g-date-body-ul .g-mark-text {
            font-size: 10px;
            display: block;
            -webkit-text-size-adjust: none;
            -webkit-transform: scale(0.66,0.66);
        }
        /* 标记样式 */
        /* .date li{
            cursor: pointer;
        }
        .date-content .active {
            border-radius:0;
            color: #fff;
            background: #5079EE;
            border: 0;
        } */
    </style>
</head>


<body>
    <div class="calendar-container" id="calendarContainer">
    </div>

    <script src="date.js"></script>
    <script>
        var markStatus = {
            0: '非配送日',
            1: '时间冲突',
            2: '进行中',
            3: '不配送',
            4: '已完成'
        };
        var markStyle = {
            0: 'g-mark-defalut',
            1: 'g-mark-time-conflict',
            2: 'g-mark-sending',
            3: 'g-mark-notsend',
            4: 'g-mark-completed'
        };
        var markData = [{
            status: 1,
            date: '2019-07-14'
        },
        {
            status: 3,
            date: '2019-07-20'
        },
        {
            status: 3,
            date: '2019-07-27'
        },
        {
            status: 2,
            date: '2019-07-21'
        },
        {
            status: 4,
            date: '2019-07-17'
        }]
        var markData1 = {
            "1563033600000": {
                status: 1,
                style: 'g-mark-time-conflict',
                text: '时间冲突'
            },
            "1563552000000": {
                status: 3,
                style: 'g-mark-notsend',
                text: '不配送'
            },
            "1564156800000": {
                status: 3,
                style: 'g-mark-notsend'
            },
            "1563638400000": {
                status: 2,
                style: 'g-mark-sending',
                text: '进行中'
            },
            "1563292800000": {
                status: 4,
                style: 'g-mark-completed',
                text: '已完成'
            }
        }
        var option = {
            container: document.getElementById('calendarContainer'),
            activateClass: 'active',
            markData: markData1,
            // weekTitle: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
            initDate: '2019-07-3',
            clickDayCallback: function(){
                console.error("点击了当前日期");
            },
            changeMonthCallback: function (callback) {
                console.error("切换月份回调");
                callback && callback();
            },
            cusClass: 'cus-style',
            data: ['2019-7-14', '2019-6-19', '2019-6-4'],
            defalutActive: 'defalutActive'
        };
        var calendar = new Calendar(option, function (type, event) {
            // type 1 当前日期 2当前选中日期dom
            console.error("日历生成结束");
        });
        calendar.init();
        // function to(num) {
        //     var stamp = null;
        //     if (num == 1) {
        //         stamp = document.getElementById('calendarHeaderLeft').getAttribute("data-stamp");
        //     } else if (num == 2) {
        //         stamp = document.getElementById('calendarHeaderRight').getAttribute("data-stamp");
        //     }
        //     calendar.changeMonth(stamp);
        // };
        function getDateDiff(time) {
            //将xxxx-xx-xx的时间格式，转换为 xxxx/xx/xx的格式 
            return time.replace(/\-/g, "/");
        };
        
    </script>
</body>

</html>